package com.cloudptt.api.product.config.call;

import android.content.Context;
import android.content.SharedPreferences;

import com.cloudptt.api.pjsip.api.BaseCallConfig;
import com.cloudptt.api.product.log.Log;

public class CallConfig extends BaseCallConfig 
{
	private static String THIS_FILE = "CallConfig";
	private String privateRecipient = null;
	private String groupInitiation = null;
	public CallConfig(Context ctx)
	{
		super(ctx);
	}

	public void setEmergencyCall(String privateRecipient,String groupInitiation )
	{
		this.privateRecipient = privateRecipient;
		this.groupInitiation = groupInitiation;
	}

	public void setConfig(String key, boolean val)
	{
		SharedPreferences.Editor editor = sp.edit();
		editor.putBoolean( key, val );
		editor.commit();
		
		Log.d( THIS_FILE, "key=" + key + ",value=" +val );
		if( key.equals( VIDEO_ENABLE ) )
		{
			setVideoEnable( val );
		}
	}
	
	public void clearUserInfoAfterLogout() 
	{
		Log.d(THIS_FILE,"clearUserInfoAfterLogout");
		this.groupCallType = GroupCall_Type_Muti;
		this.timerOption = Default_Timer_Option;
		SharedPreferences.Editor editor = sp.edit();
		editor.putInt(GroupCall_Type, GroupCall_Type_Muti);
		editor.putString(Timer_Option, ""+Default_Timer_Option);
		editor.commit();
	}
}
